import request from './request'

interface LoginForm {
  username: string
  password: string
}

interface LoginResponse {
  success: boolean
  token: string
  message?: string
}

interface LogoutResponse {
  success: boolean
  message?: string
}

export const login = (data: LoginForm): Promise<LoginResponse> => {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export const logout = (): Promise<LogoutResponse> => {
  return request({
    url: '/logout',
    method: 'post'
  })
}